import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, IsBoolean } from 'class-validator';
import { PaginationDto } from '../../common/dto/pagination.dto';

export class QueryUsersDto extends PaginationDto {
  @ApiProperty({
    description: '用户名（模糊搜索）',
    example: 'admin',
    required: false
  })
  @IsOptional()
  @IsString()
  username?: string;

  @ApiProperty({
    description: '邮箱（模糊搜索）',
    example: 'admin@',
    required: false
  })
  @IsOptional()
  @IsString()
  email?: string;

  @ApiProperty({
    description: '昵称（模糊搜索）',
    example: '管理员',
    required: false
  })
  @IsOptional()
  @IsString()
  nickname?: string;

  @ApiProperty({
    description: '用户角色',
    example: 'admin',
    required: false
  })
  @IsOptional()
  @IsString()
  role?: string;

  @ApiProperty({
    description: '是否激活',
    example: true,
    required: false
  })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;

  @ApiProperty({
    description: '开始时间（创建时间范围查询）',
    example: '2025-01-01T00:00:00.000Z',
    required: false
  })
  @IsOptional()
  @IsString()
  startDate?: string;

  @ApiProperty({
    description: '结束时间（创建时间范围查询）',
    example: '2025-12-31T23:59:59.999Z',
    required: false
  })
  @IsOptional()
  @IsString()
  endDate?: string;
}
